import request from '@/utils/request'

// 获取员工简单列表
export const getEmployeesSimple = () => request.get('/sys/user/simple')

// 获取员工列表
export const getEmployeeList = params => request.get('/sys/user', {
    params
})

// 删除员工
export const delEmployee = id => request.delete(`/sys/user/${id}`)

// 新增员工
export const addEmployee = data =>  request.post(`/sys/user`, data)

// 导入员工
export const importEmployee = data => request.post('/sys/user/batch', data)

// 获取员工详细信息
export const getEmployeeDetail = id => request.get(`/employees/${id}/personalInfo`)

// 保存员工详细信息
export const saveEmployeeDetail = data => request({
    url: `/employees/${data.userId}/personalInfo`,
    method: 'PUT',
    data
})

// 获取员工岗位信息
export const getJobDetail = id => request.get(`/employees/${id}/jobs`)

// 保存员工岗位信息
export const saveJobDetail = data => request.put(`/employees/${data.userId}/jobs`, data)

// 给员工分配角色
export const assignRole = data => request.put('/sys/user/assignRoles', data)